package org.mobai.flow.strategy.impl;

import org.camunda.bpm.model.bpmn.builder.AbstractFlowNodeBuilder;
import org.camunda.bpm.model.bpmn.builder.EndEventBuilder;
import org.mobai.flow.pojo.bpmn.node.EndEvent;
import org.mobai.flow.strategy.BpmnStrategy;
import org.springframework.stereotype.Component;

import java.util.Map;

/**
 * @author mobai
 */
@Component
public class EndEventBpmnImpl implements BpmnStrategy<EndEvent> {
    @Override
    public AbstractFlowNodeBuilder build(AbstractFlowNodeBuilder flowNodeBuilder, EndEvent node, Map<String, String> nodeMap) {
        EndEventBuilder endEventBuilder = flowNodeBuilder.endEvent();
        endEventBuilder.id(node.getId());
        endEventBuilder.name(node.getName());
        setCamundaExecutionListener(endEventBuilder, node.getExecutionListeners());
        return endEventBuilder;
    }
}
